{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcf_help.css?v={$version}"/>
<link rel="stylesheet" href="{__ADMIN_PATH}/pcf/template.css?v={$version}" media="all">
<script src="{__PUBLIC_PATH}/common/js/jquery.min.js?v={$version}"></script>
<script src="{__PUBLIC_PATH}/admin/pcf/global.js?v={$version}"></script>
<body>
<div class="layui-fluid" id="LAY-component-layer-list">
<div class="layui-card">
<div class="head-oper">
<div class="fl">
<a data-url="{:url('/channel.filemanager/newfile',array('activepath'=>replace_path($activepath)))}" data-type="newfile" class="layui-btn mt5">
新建文件</a>
</div>
</div>
<div class="layui-card-body">
  <div class="layui-form layui-border-box layui-table-view house-table" lay-filter="formTest" lay-id="admin-arctype">
    <div class="layui-table-box">
      <div class="layui-table-body">
        <table cellspacing="0" cellpadding="0" border="0" class="layui-table layui-form" style="width:100%" lay-skin="line">
          <thead >
            <tr>
              <th><div class="layui-table-cell wauto"><span>文件名</span></div></th>
              <th class="w120 tc"><div class="layui-table-cell w120 tc"><span>文件大小</span></div></th>
              <th class="w110 tc"><div class="layui-table-cell w110 tc"><span>更新时间</span></div></th>
              <th class="w100 tc"><div class="layui-table-cell w100 tc"><span>操作</span></div></th>
            </tr>
         </thead>
         <tbody>
          {if !$list}
            <tr><td colspan="4" class="no-data tc">没有符合条件的数据</td></tr>
          {else/}
            {foreach name="list" item="vo" key="k" }
             <tr>
                <td>
                    <div class="layui-table-cell wauto">
                      {if condition="in_array($vo['filetype'], array('dir','dir2'))"}
                        {if condition="empty($vo['filepath']) || $maxDir == $vo['filepath']"}
                          <a href="{:url('/channel.Filemanager/index')}">
                          <img src="{__PUBLIC_PATH}/common/images/{$vo.icon}" border="0" width="16" height="16" align="absmiddle">
                          &nbsp;{$vo.filename}</a>
                        {else/}
                          <a href="{:url('/channel.Filemanager/lists',array('activepath'=>replace_path($vo.filepath)))}">
                          <img src="{__PUBLIC_PATH}/common/images/{$vo.icon}" border="0" width="16" height="16" align="absmiddle">
                          &nbsp;{$vo.filename}</a>
                        {/if}
                      {else/}
                        {if $vo.icon}
                        <img src="{__PUBLIC_PATH}/common/images/{$vo.icon}" border="0" width="16" height="16" align="absmiddle" {if condition="!empty($vo.filepath) && 'image' == $vo.filemine"}onmouseover="layer_tips=layer.tips('<img src={__PUBLIC_PATH}/{$vo.filepath} class=\'layer_tips_img\'>',this,{tips: [1, '#fff']});"{/if} onmouseout="layer.close(layer_tips);">
                        {/if}
                        &nbsp;
                        {eq name="$vo['filemine']" value='image'}
                            <a href="{$vo['filepath']}" target="_blank">{$vo.filename}</a>
                        {else/}
                            <a href="javascript:void(0);" class="gzpcf-event" data-type="edit" data-url="{:url('/channel.Filemanager/edit',array('filename'=>$vo['filename'], 'activepath'=>replace_path(dirname($vo['filepath']))))}">{$vo.filename}</a>
                        {/eq}
                      {/if}
                      {$vo.intro}
                    </div>
                </td>
                <td><div class="layui-table-cell w120 tc">{$vo.filesize|default=''}</div></td>
                <td><div class="layui-table-cell w110 tc">{if $vo.filetime}{$vo.filetime}{/if}</div></td>
                <td>
                   <div class="layui-table-cell w100 tc"> 
                      {eq name="$vo['filemine']" value='image'}
                        {if condition="in_array($vo['filetype'], $replaceImgOpArr)"}
                            <a class="layui-btn layui-btn-xs" data-url="{:url('/channel.Filemanager/replace_img',array('filename'=>$vo['filename'], 'activepath'=>replace_path(dirname($vo['filepath']))))}" data-type="replace_img">
                            <i class="layui-icon layui-icon-picture-fine"></i>替换</a>
                        {/if}
                      {else/}
                        {if condition="in_array($vo['filetype'], $editOpArr)"}
                            <a class="layui-btn layui-btn-xs" data-url="{:url('/channel.Filemanager/edit',array('filename'=>$vo['filename'], 'activepath'=>replace_path(dirname($vo['filepath']))))}" data-type="edit">
                            <i class="layui-icon layui-icon-edit"></i>编辑</a>
                        {/if}
                      {/eq}
                   </div>
                </td>
              </tr>
            {/foreach}
          {/if}
          </tbody>
        </table>
      </div>
    </div>
<div class="layui-table-page">
  <ul class="pagination">
    <span class="rows">共 {$list|count} 条数据</span>
  </ul>
</div>
</div>
</div>
</div>
</div>
{include file="public/footer"/}
<script>
layui.use(['layer', 'form', 'table'], function () {
    var $ = layui.$,
        form = layui.form,
        table = layui.table;
    var active = {
        newfile: function(){
          var iframes = layer.open({
              type: 2,
              title: '新建文件',
              fixed: true,
              shadeClose: false,
              shade: 0.3,
              content: $(this).attr('data-url')
          });
          layer.full(iframes);
        },
        edit: function(){
          var iframes = layer.open({
              type: 2,
              title: '编辑文件',
              fixed: true,
              shadeClose: false,
              shade: 0.3,
              content: $(this).attr('data-url')
          });
          layer.full(iframes);
        },
        replace_img: function(){
          var iframes = layer.open({
              type: 2,
              title: '替换图片',
              fixed: true,
              shadeClose: false,
              shade: 0.3,
              content: $(this).attr('data-url')
          });
          layer.full(iframes);
        }
    };
    $('#LAY-component-layer-list .layui-btn,.gzpcf-event').on('click', function(){
        var type = $(this).data('type');
        active[type] && active[type].call(this);
    });
});
</script>
